package com.settlement.system.common.enums;


import com.settlement.system.common.util.common.EnumUtil;

import java.util.Optional;

/**
 *
 * 描述: 需要FSP转换的枚举  <br>
 * @author hc <br>
 */
public enum NeedChangeEnum implements Code<String>{

	/** 0:大类 */CATEGORYNO("CATEGORYNO","大类"),
	/** 1:销售店铺 */SOURCESTORE("SOURCESTORE","销售店铺"),
	;
	private final String code;
	private final String name;

	NeedChangeEnum(String code,String name){
		this.code=code;
		this.name=name;
	}


	public static String getName(String code){
		return Optional.ofNullable(witch(code)).map(i->i.name).orElse(null);
	}


	@Override
	public String code(){
		return code;
	}

	/**
	 * 数值获取对应的 NeedChangeEnum
	 * @param code
	 * @return
	 */
	public static NeedChangeEnum witch(String code){
		return EnumUtil.witch(code, NeedChangeEnum.class,null);
	}
}